package com.ltwc.lttv.api;

import android.content.Context;

import androidx.annotation.NonNull;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * Description：
 * Created on 2024/2/5 10:50
 * Organization:华云
 * author：AHuangSHang
 **/
class MyInterceptor implements Interceptor {
    private final Context context;

    public MyInterceptor(Context context) {
        this.context = context;
    }

    @NonNull
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        Request.Builder builder = request.newBuilder();
        builder.addHeader("Mac", context.getSharedPreferences("deviceId",Context.MODE_PRIVATE).toString());
        Request actualRequest = builder.build(); //实际的请求
        return chain.proceed(actualRequest);
    }
}
